package com.li;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.tool.xml.XMLWorkerHelper;

public class AppPdf {

		public static void main( String[] args ) throws DocumentException, IOException
	    {
			File  htmlFile=new File("D:\\test\\test.html");
			File  pdfFile=new File("D:\\test\\pdf.pdf");
	      // step 1
	        Document document = new Document();
	        // step 2
	        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(pdfFile));
	        // step 3
	        document.open();
	        // step 4
	        
	        XMLWorkerHelper.getInstance().parseXHtml(writer, document,
	                new FileInputStream(htmlFile));
	        //step 5
	         document.close();
	  
	        System.out.println( "PDF Created!" );
	    }

}
